<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet"
	href="${pageContext.request.contextPath }/static/layui/css/layui.css">
<script
	src="${pageContext.request.contextPath }/static/js/jquery-1.12.4.min.js"></script>
<script src="${pageContext.request.contextPath }/static/layui/layui.js"></script>
<style type="text/css">
#coursewarev {
	padding: 20px;
	background: #f1f1f1;
}
</style>
</head>
<body style="background:#f1f1f1; ">
	<div id="coursewarev">
		<form id="veditForm" method="post" class="layui-form white-bg radius">
			<div class="layui-form-item">
				<div class="layui-inline" style="margin-left: -20px">
					<label class="layui-form-label">课程</label>
					<div class="layui-input-block" style="width: 70%;">
						<select id="tbCurriculum" name="tbCurriculum" lay-verify="required"
							lay-search>
							<c:forEach var="d" items="${data}">
								<option value="${d.id }">${d.courseName}</option>
							</c:forEach>
						</select>
					</div>
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-inline" style="margin-left: -20px">
					<label class="layui-form-label">资源简介</label>
					<div class="layui-input-block">
						<input type="text" style="width: 95%;" required lay-verify="required" class="layui-input"
							id="resourceprofile" name="resourceprofile">
					</div>
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-inline" style="margin-left: 30px">
					<div class="layui-upload-drag" style="width: 300px;" id="test">
						<i class="layui-icon"></i>
						<p>
							<span id="filename">点击上传，或将文件拖拽到此处</span>
						</p>
					</div>
					<div class="layui-input-block">
						<input type="text" hidden="true" id="uuid" name="uuid">
					</div>
				</div>
			</div>
		</form>
	</div>
	<script type="text/javascript">
		layui.use('form', function(){
			  var form = layui.form;
			  form.render('select');
			});
		layui.use('upload', function() {
			var $ = layui.jquery, upload = layui.upload;
			upload.render({
				elem : '#test',
				url : 'upload1',
				auto : true,
				accept : 'video',
				exts : 'mp4',
				acceptMime : 'video/mp4',
				before : function(obj) {
					layer.load(2);
				},
				done : function(data) {
					layer.closeAll('loading');
					if (data.uuid == "") {
						layer.msg(data.filename);
					} else {
						$("#uuid").val(data.uuid);
						$("#filename").text(data.filename);
					}
				}
			});
		});
	</script>
</body>
</html>